//修改回收品类型信息
function add_Data() {
    var recStyName = $("#recStyName").val();
    var id = $("#id").val();
    var recStyRemarks = $("#recStyRemarks").val();
    var data = {
        "recStyID": id,
        "recStyName": recStyName,
        "recStyRemarks": recStyRemarks
    };
    $.ajax({
        url: "updateRecStyleByRecStyleName",
        type: "POST",
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        data: JSON.stringify(data),
        async: false,
        success: function (data) {
            if (data.code == 200) {
                Swal.fire("提示", "编辑数据成功", "success");
            } else {
                Swal.fire("提示", "编辑数据失败", "error");
            }
        }
    });

    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
    parent.layer.close(index); //执行关闭
    parent.location.href = "/yihuan/Background-RecStyleList.html";//回到父级页面
}

//查询回收品类型信息

$("#add_Data").click(function () {
    add_Data();
});

$(function () {
    var id = $("#id").val();
    var data = {
        "recStyID": id
    };
    $.ajax({
        url: "findRecStyleByRecStyID",
        type: "POST",
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        data: JSON.stringify(data),
        async: false,
        success: function (data) {
            if (data.code == 200) {
                $("#recStyName").val(data.recStyle_List[0].recStyName);
                $("#recStyRemarks").val(data.recStyle_List[0].recStyRemarks);
            }
        }
    });
});